package base;

public class Page {
	
	private int totalRecord;

	private int pageSize;
	
	private int currentPageNo;
	

	

	/**
	 * 取总页数
	 * @return
	 */
	public int getTotalPage(){
		int a=0;
		if(totalRecord%pageSize!=0)
			a= totalRecord/pageSize+1;
		else
			a= totalRecord/pageSize;
		return a;
	}
	
	/**
	 * 取上一页页码
	 * @return
	 */
	public int getPrePage(){
		if(currentPageNo>1)
			return currentPageNo-1;
		else
			return 1;
	}
	
	/**
	 * 取下一页页码
	 * @return
	 */
	public int getNextPage(){
		if(currentPageNo<this.getTotalPage())
			return currentPageNo+1;
		else
			return this.getTotalPage();
	}
	
	
	public int getStart(){
		
		return (this.currentPageNo-1)*this.pageSize;
		
	}
	
	public int getTotalRecord() {
		return totalRecord;
	}

	public void setTotalRecord(int totalRecord) {
		this.totalRecord = totalRecord;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getCurrentPageNo() {
		return currentPageNo;
	}

	public void setCurrentPageNo(int currentPageNo) {
		this.currentPageNo = currentPageNo;
	}
	
}
